The invention relates to the processing of a digital video image in general. In particular, the invention relates to removing image errors caused by block boundaries in connection with the decoding of a coded video image.
An arrangement like the one shown in FIG. 1 is generally used for transferring a digital video image in compressed form. The video image is formed of sequential frames. The current frame comes to the transmission system 10 as input data In(x,y). In the differential summer 11 it is transformed into a differential frame En(x,y) by subtracting from it a prediction frame Pn(x,y) formed on the basis of previous images. The differential frame is coded in block 12 in the manner described hereinafter, and the coded differential frame is directed to the multiplexer 13. For forming a new prediction frame, the coded differential frame is also directed to the decoder 14, which produces a decoded differential frame Ên(x,y) which is summed in the summer 15 with the prediction frame Pn(x,y), resulting in a decoded frame În(x,y). It is saved in the frame memory 16. For coding the next frame, the frame saved in the frame memory is read as a reference frame Rn(x,y) and in the motion compensation and prediction block 17 it is transformed into a new prediction frame according to the formula
Pn(x,y)=Rn[x+xcex94x(x,y), y+xcex94y(x,y)]xe2x80x83xe2x80x83(1)
The pair of numbers [xcex94x(x,y), xcex94y(x,y)] is called the motion vector of the pixel at location (x,y) and the numbers xcex94x(x,y) and xcex94y(x,y) are the horizontal and vertical shifts of the pixel. They are calculated in the motion estimation block 18 and the motion information coding block 19. The set of motion vectors [xcex94x(xc2x7), xcex94y(xc2x7)] consisting of all motion vectors related to the pixels of the frame to be compressed is also directed to the multiplexer 13, which multiplexes it into the same data stream with a coded differential frame for sending to a receiver. Some frames can be partly or entirely so difficult to predict that it is not practical to use prediction when coding them. These frames or parts of frames are coded using so-called intracoding without prediction, and motion vector information relating to them is not sent to the receiver.
In the receiver 20, the demultiplexer 21 separates the coded differential frames and the motion information transmitted by the motion vectors and directs the coded differential frames to the decoder 22, which produces a decoded differential frame Ên(x,y), which is summed in the summer 23 with the prediction frame Pn(x,y) formed on the basis of previous frames, resulting in a decoded frame În(x,y). It is directed to the output 24 of the reception decoder and at the same time saved in the frame memory 25. For decoding the next frame, the frame saved in the frame memory is read as a reference frame and transformed into a new prediction frame in the motion compensation and prediction block 26, according to the formula (1) presented above.
The coding method which is applied in block 12 to the coding of the differential frame or to the intracoding of a frame or part of it to be sent without prediction, is generally based on a transformation, the most common of which is Discrete Cosine Transformation, DCT. The frame is divided into adjacent blocks sized e.g. 8xc3x978 pixels. In coding and decoding, the blocks are processed independent of one another. The transformation is calculated for the block to be coded, resulting in a series of terms dependent on a certain variable. The coefficients of these terms are quantized on a discrete scale in order that they can be processed digitally. Quantization causes rounding errors, which can become visible in an image reconstructed from blocks so that there is a discontinuity of pixel values at the boundary of two adjacent blocks. Because a certain decoded frame is used for calculating the prediction frame for the next frames, the errors can be repeated in sequential frames, thus causing visible edges in the image reproduced by the receiver. Image errors like this are called blocking artifacts.
Some prior art methods are known for removing the blocking artifacts. These methods are characterized by the following features:
determining which pixel requires value correction for removing the blocking artefact,
determining a suitable low-pass filtering for each pixel to be corrected, based on the values of other pixels contained by the filtering window placed around the pixel,
calculating a new value for the pixel to be corrected, and
rounding the new value to the closest digitized tonal value.
Factors that influence the selection of a filter and a decision to introduce a filter can be, for example, the difference between the values of pixels across the block boundary, the size of the quantization step of the coefficients received as the transformation result, and the difference of the pixel values on different sides of the pixel being processed.
It has been found that the prior art methods also tend to remove lines of the image that should really be part of it. On the other hand, the prior art methods are not always capable of removing all blocking artifacts.
The objective of the present invention is to present a new kind of filtering arrangement for removing the blocking artifacts. The invention also has the objective that the method and device according to it operate more reliably and efficiently than the prior art solutions.
The objectives of the invention are achieved by adapting the selection of pixels for filtering and the filtering process more flexibly than before to the features of the frame and the environment of the filtering point.
The method according to the invention for removing blocking artifacts from a frame that has been coded by blocks and decoded after that, in which method a certain number of pixels from both sides of the block boundary are selected for examination, is characterized in that the number of pixels selected for examination depends on the image content of the frame in the environment of the block boundary.
The invention also relates to a device for implementing the method according to the invention. The device according to the invention is characterized in that it comprises means that operate adaptively according to the image content of the frame for selecting the pixels for examination and filtering.
Because blocking artifacts only occur at block boundaries, the filtering according to the invention is only focused on pixels at block boundaries and the immediate vicinity thereof. Edges that are part of the image can be anywhere in the image area. In order that only pixels containing blocking artefacts would be selected for correction and that the quality of edges that are part of the image would not be deteriorated during filtering, the following assumptions have been made in the study that resulted in the invention:
in edges that are part of the image, the tonal value change is generally larger than in blocking artifacts, and
the real image edges in which the tonal value change is small do not suffer considerably from the rounding of the tonal value difference by filtering.
Because the image to be coded is generally divided into blocks both vertically and horizontally, the image contains both vertical and horizontal block boundaries. With regard to vertical block boundaries, there are pixels to the right and left of the boundary, and with regard to the horizontal block boundary, there are pixels above and below the boundary. In general, the location of the pixels can be described as being on the first and second side of the block boundary. In the filtering according to the invention, the number of pixels to be corrected, the characteristic features of the filter being used and the size of the filtering window depend on the following factors:
a) the difference of the pixel values xcex94 across the block boundary (the difference can be defined in many ways; one definition is xcex94=|r1xe2x88x92l1|, where r1 is the value of the pixel on the first side of the block boundary closest to the boundary, and l1 is the value of the pixel on the second side of the block boundary closest to the boundary),
b) the size of the quantization step QP of the coefficients received as the result of the transformation used in the coding, and
c) the differences of the pixel values between the pixels on the first side of the block boundary, and correspondingly between the pixels on the second side of the block boundary.
In the method and device according to the invention, the number of the pixels to be selected for filtering can vary, and it is not necessarily the same on different sides of the block boundary. Because the number of pixels is adapted according to the factors mentioned above to the general features of the image information contained by the frame in the domain in question, the method is more reliable than the prior art methods. A larger number of blocking artifacts can be removed without weakening the real image edges unreasonably.